from collections import Counter
from functools import reduce


def singleNumber1(nums):
    return reduce(lambda x, y: x ^ y, nums)


def singleNumber2(nums):
    """异或位运算寻找只出现一次的值"""
    for i in range(1, len(nums)):
        nums[0] ^= nums[i]
    return nums[0]


def singleNumber3(nums):
    for k, v in Counter(nums).items():
        if v == 1:
            return k
